import React from 'react';
import { connect } from 'dva';
import styles  from './CartPage.css';

class CartPage extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      src:'http://static2.tuicool.com/images/upload/pgyer120.jpg',
      show: true
    }
  }

  render() {
    return (
      <div onClick={()=>{console.log('click')}}>
        <img src={this.state.src} onLoad={()=>{
          this.setState({show: false})
        }} className={this.state.show?styles.img2:styles.img}/>
        {this.state.show && <img src={require('../images/icon_placeholder@2x.png')} className={styles.img}/> }
      </div>
    );
  }
}

const mapStateToProps = ({cart}) => {
  return {cart};
};

export default connect(mapStateToProps)(CartPage);
